# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer:
pkgname=py3-telethon
pkgver=1.34.0
pkgrel=1
pkgdesc="Full-featured Telegram client library"
url="https://docs.telethon.dev/"
arch="noarch"
license="MIT"
depends="
	py3-pyaes
	py3-rsa
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-pytest-asyncio
	"
subpackages="$pkgname-pyc"
source="
	https://github.com/LonamiWebs/Telethon/archive/v$pkgver/Telethon-v$pkgver.tar.gz
	fix-imghdr-and-doc-tests.patch
	"
builddir="$srcdir/Telethon-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -k 'not test_all_methods_present'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
ddc4b144be87c62b37413043102a5646c930a688e866212981ee42df55da26fd0883b4165c557ed6f128e6f628fa008c8112cb4ee56484ddcb67f6396e89ac95  Telethon-v1.34.0.tar.gz
ead43b025d3717d901a7c9dc4d6c42c54f7288cf2e4b6910496817ba7cf011c95afdfcf908f4dea7ff888b67abdc9a60c1a44832d859566310b5f36d17ef5685  fix-imghdr-and-doc-tests.patch
"
